/*
 * @Date         : 2024-05-17 11:37:28 星期5
 * @Author       : xut
 * @Description  :
 */
import { createClient } from "redis"

const redisUrl = `redis://localhost:6379`
export const redisClient = createClient({ url: redisUrl })

const connectRedis = async () => {
  try {
    await redisClient.connect()
    console.log("? Redis client connected...")
    redisClient.set(
      "tRPC",
      "??Welcome to tRPC with React.js, Express and Typescript!"
    )
  } catch (err: any) {}
}

connectRedis()

redisClient.on("error", (err) => console.error(err))
